import { createRouter, createWebHashHistory } from "vue-router";

// 1. 创建路由规则
const routes = [
    // {
    //     path: '/login',
    //     name: 'Login',
    //     component: () => import('../views/Login.vue')
    // },
    // {
    //     path: '/register',
    //     name: 'Register',
    //     component: () => import('../views/Register.vue')
    // },
    {
        path: '/404',
        name: '404',
        component: () => import('../views/404.vue')
    },
    {
        path: "/",
        name: "layout",
        component: () => import("../views/layout/index.vue"),
        redirect: "/home",
        children: [
            {
                path: '/home',
                name: 'Home',
                component: () => import('../views/home/index.vue')
            },
            {
                path: 'homeDetail',
                name: 'HomeDetail',
                component: () => import('../views/homeDetail/index.vue')
            },
            {
                path: 'adopt',
                name: 'Adopt',
                component: () => import('../views/adopt/index.vue')
            },
            {
                path: 'myAdopt',
                name: 'MyAdopt',
                component: () => import('../views/myAdopt/index.vue')
            },
            {
                path: 'article',
                name: 'Article',
                component: () => import('../views/article/index.vue')
            },
            {
                path: 'articleKp',
                name: 'ArticleKp',
                component: () => import('../views/articleKp/index.vue')
            },
        ]
    }
]

// 2. 创建路由实例
const router = createRouter({
    // createWebHistory
    history: createWebHashHistory(),
    routes,
});

export default router;
